package com.agri.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import java.math.BigDecimal;

/**
 * 融资申请参数
 */
@Data
public class FinancingApplyDTO {
    @NotBlank(message = "真实姓名不能为空")
    @Length(max = 20, message = "姓名长度不能超过20个字符")
    private String realName;

    @NotBlank(message = "身份证号不能为空")
    @Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]$",
            message = "身份证号格式不正确")
    private String idCard;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    @NotNull(message = "贷款金额不能为空")
    @Min(value = 1000, message = "贷款金额不能小于1000元")
    private BigDecimal loanAmount;

    @NotBlank(message = "种植品类不能为空")
    @Length(max = 50, message = "种植品类长度不能超过50个字符")
    private String cropType;

    @NotBlank(message = "贷款用途不能为空")
    @Length(max = 200, message = "贷款用途长度不能超过200个字符")
    private String loanPurpose;

    @NotNull(message = "融资产品ID不能为空")
    @Min(value = 1, message = "融资产品ID必须大于0")
    private Long productId;

    @NotBlank(message = "身份证正面照片不能为空")
    private String idCardFrontImg;

    @NotBlank(message = "身份证背面照片不能为空")
    private String idCardBackImg;
}